package com.intelligent.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 客户对账明细表
 * @TableName customer_reconciliation_detail
 */
@TableName(value ="customer_reconciliation_detail")
@Data
public class CustomerReconciliationDetail implements Serializable {
    /**
     * 明细ID
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 关联对账单主表ID
     */
    private Long reconciliationId;

    /**
     * 关联产品表
     */
    private Long productId;

    /**
     * 关联销售订单ID
     */
    private Long salesOrderId;

    /**
     * 关联收款单ID
     */
    private Long receiptOrderId;

    /**
     * 关联退款单ID
     */
    private Long refundOrderId;

    /**
     * 本次对账金额
     */
    private BigDecimal amount;

    /**
     * 已收款金额
     */
    private BigDecimal receivedAmount;

    /**
     * 待收款金额
     */
    private BigDecimal toReceiveAmount;

    /**
     * 已退款金额
     */
    private BigDecimal refundAmount;

    /**
     * 关联出库单ID
     */
    private Long outboundOrderId;

    /**
     * 关联入库单ID
     */
    private Long inboundOrderId;

    /**
     * 创建时间
     */
    private Date createTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        CustomerReconciliationDetail other = (CustomerReconciliationDetail) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getReconciliationId() == null ? other.getReconciliationId() == null : this.getReconciliationId().equals(other.getReconciliationId()))
            && (this.getProductId() == null ? other.getProductId() == null : this.getProductId().equals(other.getProductId()))
            && (this.getSalesOrderId() == null ? other.getSalesOrderId() == null : this.getSalesOrderId().equals(other.getSalesOrderId()))
            && (this.getReceiptOrderId() == null ? other.getReceiptOrderId() == null : this.getReceiptOrderId().equals(other.getReceiptOrderId()))
            && (this.getRefundOrderId() == null ? other.getRefundOrderId() == null : this.getRefundOrderId().equals(other.getRefundOrderId()))
            && (this.getAmount() == null ? other.getAmount() == null : this.getAmount().equals(other.getAmount()))
            && (this.getReceivedAmount() == null ? other.getReceivedAmount() == null : this.getReceivedAmount().equals(other.getReceivedAmount()))
            && (this.getToReceiveAmount() == null ? other.getToReceiveAmount() == null : this.getToReceiveAmount().equals(other.getToReceiveAmount()))
            && (this.getRefundAmount() == null ? other.getRefundAmount() == null : this.getRefundAmount().equals(other.getRefundAmount()))
            && (this.getOutboundOrderId() == null ? other.getOutboundOrderId() == null : this.getOutboundOrderId().equals(other.getOutboundOrderId()))
            && (this.getInboundOrderId() == null ? other.getInboundOrderId() == null : this.getInboundOrderId().equals(other.getInboundOrderId()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getReconciliationId() == null) ? 0 : getReconciliationId().hashCode());
        result = prime * result + ((getProductId() == null) ? 0 : getProductId().hashCode());
        result = prime * result + ((getSalesOrderId() == null) ? 0 : getSalesOrderId().hashCode());
        result = prime * result + ((getReceiptOrderId() == null) ? 0 : getReceiptOrderId().hashCode());
        result = prime * result + ((getRefundOrderId() == null) ? 0 : getRefundOrderId().hashCode());
        result = prime * result + ((getAmount() == null) ? 0 : getAmount().hashCode());
        result = prime * result + ((getReceivedAmount() == null) ? 0 : getReceivedAmount().hashCode());
        result = prime * result + ((getToReceiveAmount() == null) ? 0 : getToReceiveAmount().hashCode());
        result = prime * result + ((getRefundAmount() == null) ? 0 : getRefundAmount().hashCode());
        result = prime * result + ((getOutboundOrderId() == null) ? 0 : getOutboundOrderId().hashCode());
        result = prime * result + ((getInboundOrderId() == null) ? 0 : getInboundOrderId().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", reconciliationId=").append(reconciliationId);
        sb.append(", productId=").append(productId);
        sb.append(", salesOrderId=").append(salesOrderId);
        sb.append(", receiptOrderId=").append(receiptOrderId);
        sb.append(", refundOrderId=").append(refundOrderId);
        sb.append(", amount=").append(amount);
        sb.append(", receivedAmount=").append(receivedAmount);
        sb.append(", toReceiveAmount=").append(toReceiveAmount);
        sb.append(", refundAmount=").append(refundAmount);
        sb.append(", outboundOrderId=").append(outboundOrderId);
        sb.append(", inboundOrderId=").append(inboundOrderId);
        sb.append(", createTime=").append(createTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}
